package com.lxk.map.gd.config;

import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.interceptor.Interceptor;
import com.dtflys.forest.reflection.ForestMethod;
import com.lxk.map.config.MapGdGeoProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author heyi
 * 2024/8/5
 */
@Slf4j
@Component
public class GdInterceptor<T> implements Interceptor<T> {
    @Autowired
    private MapGdGeoProperties mapGdGeoProperties;

    @Override
    public boolean beforeExecute(ForestRequest request) {
        return true;
    }

    @Override
    public void onInvokeMethod(ForestRequest request, ForestMethod method, Object[] args) {
        request.addQuery("key", mapGdGeoProperties.getKey());
    }
}
